// 定义仓储接口的命名空间
using System.Linq.Expressions;

namespace UniversalAdmin.Domain.Repositories;

// 定义一个通用的CURD仓储接口
public interface IRepository<T> where T : class
{
    Task<T?> GetByIdAsync(Guid id);
    Task<IEnumerable<T>> GetAllAsync();
    Task<IEnumerable<T>> ListAllAsync();
    Task<IEnumerable<T>> ListAsync(Expression<Func<T, bool>> predicate);
    Task<bool> AnyAsync(Expression<Func<T, bool>> predicate);
    Task<T> AddAsync(T entity);
    Task UpdateAsync(T entity);
    Task DeleteAsync(T entity);
    Task RemoveRangeAsync(IEnumerable<T> entities);
    Task AddRangeAsync(IEnumerable<T> entities);
}